import 'package:fl_demo/src/auto_size_text/text_page.dart';
import 'package:fl_demo/src/banner_list_view/banner_page.dart';
import 'package:fl_demo/src/lottie_page.dart';
import 'package:fl_demo/src/radio_page.dart';
import 'package:fl_demo/src/sliver_app_bar_page.dart';
import 'package:fl_demo/src/text_field_page.dart';
import 'package:flutter/material.dart';
import 'package:universally/universally.dart';

Future<void> main() async {
  await Universally().setConfig(UConfig());
  runApp(const _App());
}

class _App extends StatelessWidget {
  const _App();

  @override
  Widget build(BuildContext context) {
    return BaseMaterialApp(title: 'FlDemo', home: HomePage());
  }
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  void initState() {
    super.initState();
    addPostFrameCallback((_) {
      push(RadioPage());
    });
  }

  @override
  Widget build(BuildContext context) {
    return BaseScaffold(
      appBarTitleText: 'Home',
      spacing: 20,
      children: [
        ElevatedButton(
          onPressed: () {
            push(RadioPage());
          },
          child: Text('RadioPage'),
        ),
        ElevatedButton(
          onPressed: () {
            push(AutoSizeTextPage());
          },
          child: Text('AutoSizeText'),
        ),
        ElevatedButton(
          onPressed: () {
            push(BannerPage());
          },
          child: Text('BannerPage'),
        ),
        ElevatedButton(
          onPressed: () {
            push(SliverAppBarPage());
          },
          child: Text('SliverAppBarPage'),
        ),
        ElevatedButton(
          onPressed: () {
            push(LottiePage());
          },
          child: Text('LottiePage'),
        ),
        ElevatedButton(
          onPressed: () {
            push(TextFieldPage());
          },
          child: Text('TextFieldPage'),
        ),
      ],
    );
  }
}
